﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Drawing;
using Rung.EBook.Common.Model;

namespace Rung.EBook.DocFormater.Umd
{
    [Serializable]
    public class ChapterBM : ChapterBase
    {
        public List<Image> ImageList
        { get; set; }

        // Constructor
        public ChapterBM()
        {
            this.Content = string.Empty;
            this.Title = string.Empty;
            this.ImageList = new List<Image>();
        }

        // Constructor
        public ChapterBM(string title, string content)
        {
            this.Title = title;
            this.Content = content;
            this.ImageList = new List<Image>();
        }

        #region 封面图片增删
        public void AppendImage(Image picture)
        {
            this.ImageList.Add(picture);
        }

        public void RemoveImage(int index)
        {
            if ((index >= 0) && (index < this.ImageList.Count))
            {
                this.ImageList.RemoveAt(index);
            }
        } 
        #endregion

        public override string ToString()
        {
            return this.Title;
        }

        public override void FromChapterBase(ChapterBase bBase)
        {
            base.Url = bBase.Url;
            base.Title = bBase.Title;
            base.Index = bBase.Index;
            base.Content = bBase.Content;
        }
    }
}
